@extends('layouts.admin')
@section('content')
    <div id="content-header">
        <h1>用户管理</h1>
        <div class="btn-group">
            <a class="btn btn-large tip-bottom" title="Manage Files"><i class="icon-file"></i></a>
            <a class="btn btn-large tip-bottom" title="Manage Users"><i class="icon-user"></i></a>
            <a class="btn btn-large tip-bottom" title="Manage Comments"><i class="icon-comment"></i><span class="label label-important">5</span></a>
            <a class="btn btn-large tip-bottom" title="Manage Orders"><i class="icon-shopping-cart"></i></a>
        </div>
    </div>
    <div id="breadcrumb">
        <a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>用户列表</a>
        <a href="#" class="current">用户添加</a>
    </div>
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <div class="widget-box">
                    <div class="widget-title">
								<span class="icon">
									<i class="icon-th"></i>
								</span>
                        <span class="label label-info">用户首页</span>
                    </div>
                    <div class="widget-content">

                        <div class="container-fluid">
                            <div class="row-fluid">
                                <div class="span12">
                                    <div class="widget-box">
                                        <div class="widget-title">
								<span class="icon">
									<i class="icon-align-justify"></i>
								</span>
                                            <h5>轮播图</h5>
                                        </div>
                                        <div id="err" style="color:red"></div>
                                        <form action="javascript:void(0)" method="post" class="form-horizontal" id="form" />
                                        {{csrf_field()}}
                                        <table style="margin:0 auto">
                                            <tbody>
                                            <tr>
                                                <th>相册名称：</th>
                                                <td>
                                                    <input type="text" class="lg" name="name" style="margin: 10px;width:200px;height:30px">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>缩略图：</th>
                                                <td>
                                                    <input type="text" size="50" name="path" style="margin: 10px;width:200px;height:30px">
                                                    <input id="file_upload" name="file_upload" type="file" multiple="true">
                                                    <script src="{{asset('js/jquery.uploadify.min.js')}}" type="text/javascript"></script>
                                                    <link rel="stylesheet" type="text/css" href="{{asset('css/uploadify.css')}}">
                                                    <script type="text/javascript">
                                                        <?php $timestamp = time();?>
                                                            $('#file_upload').uploadify({
                                                                'buttonText':'图片上传',
                                                                'formData'     : {
                                                                    'timestamp' : '<?php echo $timestamp;?>',
                                                                    '_token'     : "{{csrf_token()}}"
                                                                },
                                                                'swf'      : "{{asset('uploadify/uploadify.swf')}}",
                                                                'uploader' : "{{url('admin/upload')}}",
                                                                'onUploadSuccess' : function(file,data,response){
                                                                    console.log(data);
                                                                    $('input[name=path]').val(data);
                                                                    $('#art_thumb_img').attr('src',data);
                                                                }
                                                            });

                                                    </script>
                                                    <style>
                                                        .uploadify{display:inline-block;}
                                                        .uploadify-button{border:none; border-radius:5px; margin-top:8px;}
                                                        table.add_tab tr td span.uploadify-button-text{color: #FFF; margin:0;}
                                                    </style>
                                                </td>
                                            </tr>
                                            <th></th>
                                            <td>
                                                <img src="" alt="" id="art_thumb_img"  style="max-width:3500px;max-height:100px">
                                            </td>
                                            </tr>
                                            <tr>
                                                <th>描述：</th>
                                                <td>
                                                    <textarea name="describe"></textarea>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>排序：</th>
                                                <td>
                                                            <input type="text" name="order" value="" id="order" style="margin: 10px;width:200px;height:30px"/>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <button type="submit" id="btntn" class="btn btn-primary" style="width:60px">提交</button>
                                                    <input type="button" class="back" onclick="history.go(-1)" value="返回">
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <div class="row-fluid">
                <div id="footer" class="span12">
                    2012 &copy; Unicorn Admin. Brought to you by <a href="https://wrapbootstrap.com/user/diablo9983">diablo9983</a>
                </div>
            </div>
        </div>
        <script>
            $('#btntn').click(function(){
                var data= $("#form").serialize();
                $.ajax({
                    type:'post',
                    dataType:'json',
                    data:data,
                    url:'{{url('admin/album/changeadd')}}',
                    success:function (data) {
                        if(data.status==0){
                            location.href=location.href;
                            layer.msg(data.msg,{icon:6});
                        }else{
                            layer.msg(data.msg,{icon:5});
                        }
                    }

                });

            });
        </script>
@endsection